package com.masterclient.app.modules.shop.adapter;

import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eoner.baselibrary.bean.shop.DealerProductFilterItemBean;
import com.masterclient.app.R;

/**
 * @auther hjian
 * @date 2020/11/5.
 */
public class DealerProductManagerFilterAdapter extends BaseQuickAdapter<DealerProductFilterItemBean, BaseViewHolder> {

    private int selectIndex;

    public void setSelectIndex(int selectIndex) {
        this.selectIndex = selectIndex;
        notifyDataSetChanged();
    }

    public DealerProductManagerFilterAdapter() {
        super(R.layout.item_dealer_product_filter);
    }

    @Override
    protected void convert(BaseViewHolder helper, DealerProductFilterItemBean item) {
        helper.setText(R.id.item_dealer_product_filter_name, item.getName())
                .setTextColor(R.id.item_dealer_product_filter_name, Color.parseColor(selectIndex==
                        helper.getAdapterPosition()?"#FF6809":"#141922"))
                .setBackgroundRes(R.id.item_dealer_product_filter_name,selectIndex== helper
                        .getAdapterPosition()?R.drawable.shape_round_fff3ec:R.drawable.shape_round_f0f2f5);
    }
}
